<template>
    <h1>用户基本信息</h1>
    <div>姓名:{{ name }}</div>
    <div>年龄:{{ age }}</div>
    <div>职业:{{ job }}</div>
    <div>介绍:{{ getUserInfo}}</div>
    <button @click="modifyUserInfo('周芷若',23,'峨嵋派掌门')">修改用户信息</button>
    <button @click="reset">重置</button>
    <button @click="patch">批量修改</button>
</template>

<script lang='ts' setup>
import useUserInfoState from '@/store/userInfo'
import {storeToRefs} from 'pinia'
const store=useUserInfoState()
const {name,age,job,getUserInfo}=storeToRefs(store)
const {modifyUserInfo}=store
const reset=()=>{
    store.$reset()
}
const patch=()=>{
    store.$patch({
        name:'宋远桥',
        age:56
    })
}
</script>

<style lang='scss' scoped>
</style>